<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var t1 = new Promise((resolve)=>{
            setTimeout(()=>{
                resolve(1000)
            },1000)
        })
        var t2 = new Promise((resolve)=>{
            setTimeout(()=>{
                resolve(2000)
            },1000)
        })
        var t3 = new Promise((resolve)=>{
            setTimeout(()=>{
                resolve(3000)
            },1000)
        })
        var arr = [t1,t2,t3];
        // forEach不支持异步
        // arr.forEach(async item=>{
        //     var res = await item;
        //     console.log(res);
        // })
        (async()=>{
            for(let i of arr){
            let res = await i;
            console.log(res);
        }
        })()
    </script>
</body>
</html>